home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / THXPlayLib / src / song.asm < prev    next >
Encoding:
Assembly Source File  |  1998-05-11  |  3.4 KB  |  165 lines

  1. ;****** thxplay.library/thxPlay ******************************************
  2. ;
  3. ;   NAME
  4. ;       thxPlay -- start playing the song.
  5. ;
  6. ;   SYNOPSIS
  7. ;       void thxPlay()
  8. ;
  9. ;       void thxPlay(void);
  10. ;
  11. ;       thxPlay()
  12. ;
  13. ;   FUNCTION
  14. ;       Starts  playing  the module. If the module has just been initialised
  15. ;       or  stopped,  or  the  subsong has just been changed, then play will
  16. ;       start  at  the  beginning  of  the  song/subsong. Otherwise, it will
  17. ;       continue from where it was paused.
  18. ;
  19. ;   SEE ALSO
  20. ;       thxStop(), thxPause()
  21. ;
  22. ;****************************************************************************
  23. ;
  24. ;
  25. thxPlay
  26.     move.l    THX+thxBSS_P(pc),d0
  27.     beq.s    .exit
  28.     move.l    d0,a0
  29.     st.b    thx_pPlaying(a0)
  30. .exit    rts
  31.  
  32.  
  33.  
  34.  
  35. ;****** thxplay.library/thxPause ******************************************
  36. ;
  37. ;   NAME
  38. ;       thxPause -- pause play of a song.
  39. ;
  40. ;   SYNOPSIS
  41. ;       void thxPause()
  42. ;
  43. ;       void thxPause(void);
  44. ;
  45. ;       thxPause()
  46. ;
  47. ;   FUNCTION
  48. ;       Pauses the playing module. Call thxPlay() to continue play again.
  49. ;
  50. ;   SEE ALSO
  51. ;       thxPlay()
  52. ;
  53. ;****************************************************************************
  54. ;
  55. ;
  56.     cnop    0,4
  57. thxPause
  58.     move.l    THX+thxBSS_P(pc),d0
  59.     beq.s    .exit
  60.     move.l    d0,a0
  61.     clr.b    thx_pPlaying(a0)
  62. .exit    rts
  63.  
  64.  
  65.  
  66.  
  67. ;****** thxplay.library/thxStop ******************************************
  68. ;
  69. ;   NAME
  70. ;       thxStop -- stop playing a song/module.
  71. ;
  72. ;   SYNOPSIS
  73. ;       void thxStop()
  74. ;
  75. ;       void thxStop(void);
  76. ;
  77. ;       thxStop()
  78. ;
  79. ;   FUNCTION
  80. ;       Stops  the  module.  Can  be restarted from the beginning again with
  81. ;       thxPlay().
  82. ;
  83. ;   SEE ALSO
  84. ;       thxPlay(), thxFree()
  85. ;
  86. ;****************************************************************************
  87. ;
  88. ;
  89.     cnop    0,4
  90. thxStop    movem.l    d2-d7/a2-a6,-(sp)
  91.     move.b    mod_OK(pc),d0
  92.     beq.s    .nosong
  93.  
  94.     lea    dosig(pc),a0
  95.     clr.w    (a0)            ; reset Signal() trigger
  96.  
  97.     lea    _notes(pc),a0
  98.     moveq    #(bn_SIZEOF*4)-1,d0    ; clear bangnote structures
  99. .clr    clr.b    (a0)+
  100.     dbra    d0,.clr
  101.  
  102.     bsr    THX+thxStopSong        ; stop song in thx player
  103.  
  104.     move.l    mod(pc),d0
  105.     beq.s    .nosong
  106.     move.l    d0,a0
  107.     bsr    THX+thxInitModule    ; reinit module
  108.     moveq    #0,d0
  109.     lea    song(pc),a0
  110.     move.w    (a0),d0            ; select current subsong
  111.     moveq    #1,d1            ; don't play immediately
  112.     bsr    THX+thxInitSubSong
  113. .nosong    movem.l    (sp)+,d2-d7/a2-a6
  114.     rts
  115.  
  116.  
  117.  
  118.  
  119. ;****** thxplay.library/thxWind ******************************************
  120. ;
  121. ;   NAME
  122. ;       thxWind -- wind the song forward or back.
  123. ;
  124. ;   SYNOPSIS
  125. ;       void thxWind(direction)
  126. ;                    D0
  127. ;
  128. ;       void thxWind(ULONG);
  129. ;
  130. ;       thxWind(direction)
  131. ;
  132. ;   FUNCTION
  133. ;       Advances forward or backwards through the song by a specified number
  134. ;       of positions. Please use the values 1 to skip forward and -1 to skip
  135. ;       back, for future compatibility.
  136. ;
  137. ;   INPUTS
  138. ;       direction - if  1, winds on to the next position.
  139. ;                   if -1, winds back to the previous position,
  140. ;                   if  0, ignored.
  141. ;
  142. ;   NOTE
  143. ;       Be  wary  of  stepping  beyond  the  end  of  a song. Also note this
  144. ;       function only takes effect only once a frame.
  145. ;
  146. ;****************************************************************************
  147. ;
  148. ;
  149.     cnop    0,4
  150. thxWind
  151.     ifd    STACKARGS
  152.     move.l    4(sp),d0
  153.     endc
  154.     movem.l    d2-d7/a2-a6,-(sp)
  155.     move.b    mod_OK(pc),d1
  156.     beq.s    .exit
  157.     tst.l    d0
  158.     beq.s    .exit            ; exit if direction=0
  159.     bmi.s    .neg            ; skip back if direction<0
  160.     bsr    THX+thxNextPattern    ; otherwise skip fwd (direction >0)
  161.     bra.s    .exit
  162. .neg    bsr    THX+thxPrevPattern
  163. .exit    movem.l    (sp)+,d2-d7/a2-a6
  164.     rts
  165.